package com.sx.zongzhi.presenter;

import android.content.Context;

import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.modle.HeadParamBean;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.utils.BaseUtil;
import com.sx.zongzhi.view.CommentView;

import java.util.Map;

/**发送消息
 * Created by admin on 2017/12/1.
 */

public class AddMailPest {
    private CommentView commentView;

    public AddMailPest(CommentView commentView) {
        this.commentView=commentView;
    }
    //收件箱消息详情
    public void addBoxDetail(Context context, String content,String title,String filePaths,
                             String userIds,String groupIds,String orgIds){
        Map<String,Object> map = HeadParamBean.getHead(context);
        map.put("platformMessage.title", title);
        if (!BaseUtil.isEmpty(content)){
            map.put("platformMessage.content", content);
        }
        if (!BaseUtil.isEmpty(filePaths)){
            map.put("filePaths", filePaths);
        }
        if (!BaseUtil.isEmpty(userIds)){
            map.put("userIds",userIds );
        }
        if (!BaseUtil.isEmpty(groupIds)){
            map.put("groupIds",groupIds );
        }
        if (!BaseUtil.isEmpty(orgIds)){
            map.put("orgIds",orgIds );
        }
        new ApiManager().addBoxDetail(map, new BaseCallBack<BaseResult<Boolean>>() {
            @Override
            public void onSuccess(BaseResult<Boolean> response) {
                commentView.commentSuccess(response.getData());
            }
            @Override
            public void onFailures(String message) {
                commentView.showError(message);
            }
        });
    }
}
